<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>页码切换</title>
    <link rel="stylesheet" href="../css/page.css">
</head>
<script src="../../js/axios.js"></script>

<body>
    
    <div class="page" id="page">
    </div>
</body>
<script src="../js/page.js"></script>
<script>
    new Page({
        ele: "#page",
        data: {
            total: 111,//数据总数是100
            shownum: 10,//表示每页显示10条数据
            showpage: 5,//表示连续的页码数为5
        },
        methods: {
            cb: async (index) => {
                console.log(`去请求第${index}页的数据`);
                var {data: list} = await axios({
                    method: "get",
                    url: "http://localhost:2345/goods",
                    params: {
                        _limit: this.shownum,//限制每页显示10条
                        _page: this.index,//第几页
                    }
                })
            }
        }
    });
</script>

</html>